package View;

import com.cqtczh.qhd.driver.R;
import com.cqtczh.qhd.driver.acticity.ProjectHomeActivity;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * * @author 作者 陈修园:
 * 
 * @date 创建时间：2015-5-27 下午5:04:06
 * @version 1.0
 * @parameter
 * @since
 * @return
 */
public class dialogCE {
	Context context;
	LayoutInflater inflater;
	LinearLayout layout;
	Dialog dialog;
    public Button submit;
    public Button giveup;
	TextView titleview ;
	TextView messageview;

	public dialogCE(Context context) {
		// TODO Auto-generated constructor stub
		this.context = context;
		Ini();
	}

	private void Ini() {
		inflater = LayoutInflater.from(context);
		layout = (LinearLayout) inflater.inflate(R.layout.alert_dialog, null);
		dialog = new AlertDialog.Builder(context).create();
	}

	public void setText(String title, String message) {
	//	Log.v("出来", "出来");
		dialog.show();
//		Log.v("出来1", "出来1");
		dialog.setContentView(layout);
	
		titleview = (TextView) layout.findViewById(R.id.title);
		messageview = (TextView) layout.findViewById(R.id.message);
		titleview.setText("message");
		submit=(Button) layout.findViewById(R.id.check);
		giveup=(Button) layout.findViewById(R.id.giveup);
		giveup.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				dialog.dismiss();
			}
		});
	//	Log.v("出来3", "出来3");
	}
	
	
	

	public void setSubmitOnClick(OnClickListener clickListener){
		submit.setOnClickListener(clickListener);
		dialog.dismiss();
	}

	

}
